#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdio.h>
void swap(int* x1, int* x2)
{



	int tmp = *x1;
	*x1 = *x2;
	*x2 = tmp;


}
void quicksort(int* arr, int left, int right)
{
	if (left >= right)
	{
		return;
	}

	int key1 = left;

	int prev = left;

	int cur = left + 1;
	while (cur <= right)
	{

		if (arr[cur] < arr[key1] && ++prev != cur)
		{

			swap(&arr[prev], &arr[cur]);

		}
		cur++;

	}
	swap(&arr[key1], &arr[prev]);
	key1 = prev;

	quicksort(arr, left, key1 - 1);

	quicksort(arr, key1 + 1, right);

}

void sortprintf(int* arr, int sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
}

int main()
{
	int arr[10] = { 1,3,5,7,9,2,4,6,8,0 };

	int sz = sizeof(arr) / sizeof(arr[0]);
	quicksort(arr, 0, sz - 1);
	sortprintf(arr, sz);
	return 0;

}